package iteratorPattern;

public class Client {

    public static void main(String[] args) {

        StudentAggregate studentAggregate = new StudentAggregateImpl();
        studentAggregate.addStudent(new Student("张三", "白色校服"));
        studentAggregate.addStudent(new Student("李四", "白色校服"));
        studentAggregate.addStudent(new Student("王五", "黑色校服"));
        studentAggregate.addStudent(new Student("小明", "红色校服"));

        StudentIterator iterator = studentAggregate.getIterator();
        while (iterator.hasNext()) {
            Student student = iterator.next();
            String name = student.getName();
            String number = student.getNumber();
            System.out.println(name + "--" + number);
        }

    }
}
